1. Field of the Invention
This invention relates generally to the field of data compression. More particularly, this invention relates to a method and apparatus for data compression using adaptive bit rate control which is particularly well suited for compression of video data which should be maintained at an approximately constant compressed data size.
2. Background of the Invention
Referring to FIG. 1, a typical field-based video data compression system 10, such as a JPEG (Joint Pictures Expert Group) style system, includes a source data memory 12 which provides data to a video compressor 16. A compressed data counter 20 makes a determination of the size of the compressed data and provides this information to a bit rate controller 24. The bit rate controller makes a determination of a quantizer scale factor and provides this information to the video compressor 16. The compressed data from the video compressor 16 is provided to a compressed data memory 28 which is ultimately used as the source of data for a transport medium 32 (or storage medium).
The source data memory 12 contains the uncompressed video data. The video compressor 16 processes data from the source data memory, reduces its data volume, and stores the compressed video data into the compressed data memory 28. The compressed data counter 20 counts the number of compressed data bytes output by the video compressor 16 during each field. The bit rate controller 24 adjusts the compression parameters to control the volume of data output by the video compressor 16. Compressed video data is moved via the transport medium 32 to other locations.
In a JPEG style video compressor such as 16, compression takes place in three stages: transform 40, quantization 44, and entropy coding 48. In the transform stage, video data is transformed from time domain information into a frequency domain representation using, for example, a discrete cosine transform or fast Fourier transform or the like. This frequency domain information is represented as a matrix. In the quantization stage 44, transformed data is divided by a value from scaled quantizer matrix produced by quantization matrix scaler 52. A large quantizer scale factor at 56 creates larger values in the scaled quantizer matrix at 60, and causes more information to be discarded in the quantization operation of quantizer 44. The compression ratio, defined to be the size of the source video data divided by the size of the compressed video data, is primarily determined by the value of the quantizer scale factor at 56.
Many video compression techniques, such as the JPEG compression standard, produce a compressed data stream that varies in volume depending on the complexity of the source video image. However, in many cases the compressed data stream must then be carried by some medium which has limited data carrying capacity. To prevent overflow of the transport medium, the volume of data produced by the compression technique must be controlled.
Typically, a buffer memory such as 28 is inserted between the output of the variable bit rate video compression circuitry and the input of the constant bit rate transport medium. The buffer memory is used to smooth out variations in the volume of data output by the compression circuitry. Because the buffer memory size is limited, the volume of data produced by the video compression circuitry must still be controlled to prevent buffer overflow.
For most field,based video compression systems, the amount of compression is primarily controlled by the quantization process. In this process, a matrix of transformed video data is divided by a quantization matrix at 44. Because the remainder of the division operation is discarded, information is lost and the number of bits required to represent the source data is reduced. The compressed data volume is controlled at quantization matrix scaler 52 by multiplying the quantization matrix by the quantizer scaling factor at 56. A large quantizer scaling factor increases all of the values in the quantization matrix, which results in more data being discarded in the division operation, and consequently a lower output data volume.
In most applications, the volume of data produced by the video compression circuitry must very closely match the data carrying capacity of the transport medium. To produce this precise control over data volume, an iterative process is used to pick the optimal quantizer scale factor. This iterative process requires each field of data to be compressed multiple times. For a particular field of video data, typically an initial quantizer scale factor is selected, and compression is performed. The volume of data produced is compared to the desired data volume, and the quantizer scale factor is adjusted. If the target data volume was exceeded, the quantizer scale factor is increased, and vice versa. This process is repeated several times until an optimal quantizer scale factor is found for a particular field. The object is to closely match the capacity of the transport medium so that the best quality picture is obtained consistent with the limitations of the transport medium.
Iteration to produce an optimal quantizer scale factor provides precise control over compressed data volume, but can become impractical in real-time systems. In a real-time system, every field must be compressed in a time no longer than one field time. If iteration is used, then a particular field must be compressed several times during one field time, or several compression circuits must be used in parallel. In either case, the system cost can be high due to the need for extremely high speed processing or multiple processors (compressors) are needed to implement the compression.